/**
 * Copyright (c) 2014, 2017, Oracle and/or its affiliates.
 * The Universal Permissive License (UPL), Version 1.0
 */
"use strict";
define(["ojs/ojcore","jquery","ojs/ojcomponentcore","ojs/ojdatasource-common"],function(a,g){a.dh=function(a,c){this.eKa=a;this.fd=c};o_("EmptyNodeSet",a.dh,a);a.dh.prototype.getParent=function(){return this.eKa};a.b.g("EmptyNodeSet.prototype.getParent",{getParent:a.dh.prototype.getParent});a.dh.prototype.getStart=function(){return this.fd};a.b.g("EmptyNodeSet.prototype.getStart",{getStart:a.dh.prototype.getStart});a.dh.prototype.getCount=function(){return 0};a.b.g("EmptyNodeSet.prototype.getCount",
{getCount:a.dh.prototype.getCount});a.dh.prototype.getData=function(){return null};a.b.g("EmptyNodeSet.prototype.getData",{getData:a.dh.prototype.getData});a.dh.prototype.getMetadata=function(){return null};a.b.g("EmptyNodeSet.prototype.getMetadata",{getMetadata:a.dh.prototype.getMetadata});a.eh=function(a,c){this.sc=a;this.fd=c};o_("FlattenedNodeSet",a.eh,a);a.eh.prototype.getParent=function(){return this.sc.getParent()};a.b.g("FlattenedNodeSet.prototype.getParent",{getParent:a.eh.prototype.getParent});
a.eh.prototype.getStart=function(){return void 0!=this.fd?this.fd:this.sc.getStart()};a.b.g("FlattenedNodeSet.prototype.getStart",{getStart:a.eh.prototype.getStart});a.eh.prototype.getCount=function(){void 0===this.vN&&(this.vN=this.H7(this.sc,0),void 0!=this.fd&&(this.vN-=this.fd));return this.vN};a.b.g("FlattenedNodeSet.prototype.getCount",{getCount:a.eh.prototype.getCount});a.eh.prototype.H7=function(a,c){var d,e,f,g;d=a.getStart();e=a.getCount();c+=e;if(a.ri)for(f=0;f<e;f++)g=a.ri(f+d),null!=
g&&(c=this.H7(g,c));return c};a.eh.prototype.getData=function(a){return this.lT(this.sc,a,{index:this.sc.getStart()},this.Ob)};a.b.g("FlattenedNodeSet.prototype.getData",{getData:a.eh.prototype.getData});a.eh.prototype.getMetadata=function(a){return this.lT(this.sc,a,{index:this.sc.getStart()},this.IT)};a.b.g("FlattenedNodeSet.prototype.getMetadata",{getMetadata:a.eh.prototype.getMetadata});a.eh.prototype.IT=function(a,c){return a.getMetadata(c)};a.eh.prototype.Ob=function(a,c){return a.getData(c)};
a.eh.prototype.lT=function(a,c,d,e){var f,g,k,l;f=a.getStart();g=a.getCount();for(k=0;k<g;k++){l=d.index;if(l===c)return e.call(this,a,k+f);d.index=l+1;if(a.ri&&(l=a.ri(k+f),null!=l&&(l=this.lT(l,c,d,e),null!=l)))return l}return null};a.zj=function(a,c,d){this.Rt=a;this.a_=c;this.$Z=this.Yta(d)};o_("MergedNodeSet",a.zj,a);a.zj.prototype.Yta=function(a){var c,d,e;c=this.Rt.getStart();for(d=c+this.Rt.getCount();c<d;c++)if(e=this.Rt.getMetadata(c).key,a===e)return c;return d-1};a.zj.prototype.getParent=
function(){return this.Rt.getParent()};a.b.g("MergedNodeSet.prototype.getParent",{getParent:a.zj.prototype.getParent});a.zj.prototype.getStart=function(){return this.Rt.getStart()};a.b.g("MergedNodeSet.prototype.getStart",{getStart:a.zj.prototype.getStart});a.zj.prototype.getCount=function(){return this.Rt.getCount()+this.a_.getCount()};a.b.g("MergedNodeSet.prototype.getCount",{getCount:a.zj.prototype.getCount});a.zj.prototype.getData=function(a){a=this.J8(a);return a.set.getData(a.index)};a.b.g("MergedNodeSet.prototype.getData",
{getData:a.zj.prototype.getData});a.zj.prototype.getMetadata=function(a){a=this.J8(a);return a.set.getMetadata(a.index)};a.b.g("MergedNodeSet.prototype.getMetadata",{getMetadata:a.zj.prototype.getMetadata});a.zj.prototype.J8=function(a){if(a<=this.$Z)return{set:this.Rt,index:a};var c=this.a_.getCount();return a>this.$Z+c?{set:this.Rt,index:a-c}:{set:this.a_,index:a-(this.$Z+1)}};a.jh=function(a,c,d,e){this.sc=a;this.jm=c;this.SA=d;this.km=e};o_("NodeSetWrapper",a.jh,a);a.jh.prototype.getParent=function(){return this.sc.getParent()};
a.b.g("NodeSetWrapper.prototype.getParent",{getParent:a.jh.prototype.getParent});a.jh.prototype.getStart=function(){return null!=this.SA?this.SA.start:this.sc.getStart()};a.b.g("NodeSetWrapper.prototype.getStart",{getStart:a.jh.prototype.getStart});a.jh.prototype.getCount=function(){var a,c;a=this.sc.getStart();c=this.sc.getCount();null!=this.SA&&(this.SA.start>a?c=Math.min(0,c-(this.SA.start-a)):this.SA.start<a&&(c=0));return c};a.b.g("NodeSetWrapper.prototype.getCount",{getCount:a.jh.prototype.getCount});
a.jh.prototype.getData=function(a){return this.sc.getData(a)};a.b.g("NodeSetWrapper.prototype.getData",{getData:a.jh.prototype.getData});a.jh.prototype.getMetadata=function(a){var c;c=this.sc.getMetadata(a);c.index=a;c.parentKey=this.getParent();this.jm.call(null,c.key,c);return c};a.b.g("NodeSetWrapper.prototype.getMetadata",{getMetadata:a.jh.prototype.getMetadata});a.jh.prototype.ri=function(b){return null!=this.km&&-1!=this.km.indexOf(this.sc.getMetadata(b).key)||!this.sc.ri||(b=this.sc.ri(b),
null==b)?null:new a.jh(b,this.jm,null,this.km)};a.b.g("NodeSetWrapper.prototype.getChildNodeSet",{ri:a.jh.prototype.ri});a.ua=function(b,c){this.Bf=b;this.pa=c||{};a.ua.u.constructor.call(this)};o_("FlattenedTreeDataSource",a.ua,a);a.b.sa(a.ua,a.Fm,"oj.FlattenedTreeDataSource");a.ua.prototype.Init=function(){var b;a.ua.u.Init.call(this);this.Bf.on("change",this.Dxa.bind(this));this.RZ=parseInt(this.pa.fetchSize,10);isNaN(this.RZ)&&(this.RZ=25);this.Ww=parseInt(this.pa.maxCount,10);isNaN(this.Ww)&&
(this.Ww=500);b=this.pa.expanded;Array.isArray(b)?this.vr=b:("all"===b&&(this.km=[]),this.vr=[]);this.rr=[]};a.b.g("FlattenedTreeDataSource.prototype.Init",{Init:a.ua.prototype.Init});a.ua.prototype.handleEvent=function(b,c){return a.ua.u.handleEvent.call(this,b,c)};a.b.g("FlattenedTreeDataSource.prototype.handleEvent",{handleEvent:a.ua.prototype.handleEvent});a.ua.prototype.bh=function(){delete this.rr;delete this.vr;delete this.km;this.Bf.off("change");this.Bf.bh&&this.Bf.bh()};a.b.g("FlattenedTreeDataSource.prototype.Destroy",
{bh:a.ua.prototype.bh});a.ua.prototype.gm=function(){return this.RZ};a.ua.prototype.LM=function(){return this.vr};a.b.g("FlattenedTreeDataSource.prototype.getExpandedKeys",{LM:a.ua.prototype.LM});a.ua.prototype.xF=function(a){return null!=this.pa?this.pa[a]:null};a.b.g("FlattenedTreeDataSource.prototype.getOption",{xF:a.ua.prototype.xF});a.ua.prototype.getWrappedDataSource=function(){return this.Bf};a.b.g("FlattenedTreeDataSource.prototype.getWrappedDataSource",{getWrappedDataSource:a.ua.prototype.getWrappedDataSource});
a.ua.prototype.sT=function(a){var c,d;c=this.gm();d=this.Ww;return-1===c?-1===a?d:a:-1===a?Math.min(c,a):c};a.ua.prototype.tp=function(a,c){this.jz()?this.Rta(a,c):this.Qta(a,c)};a.ua.prototype.Qta=function(b,c){var d,e,f,g,k,l;if(b.start>this.Kg()){d=this.DT();if(0>this.Kg()){b.count=Math.min(d,b.count);this.Bf.fetchChildren(null,b,{success:function(a){this.Qs(a,null,0,b,0,c)}.bind(this),error:function(a){this.Fq(a,c)}.bind(this)});return}if(0<d){e=this.i8();f=e.parent;g=this.Bf.getChildCount(f);
k=e.index;l=e.depth;-1===g||k<g-1?(e=this.sT(g),b.start=k+1,b.count=-1===g?Math.min(e,b.count):Math.min(d,Math.min(Math.min(e,b.count),g-b.start)),this.Bf.fetchChildren(f,b,{success:function(a){this.Qs(a,f,l,b,g,c)}.bind(this),error:function(a){this.Fq(a,c)}.bind(this)})):k===g-1?(d=new a.dh(null,b.start),null!=c&&null!=c.success&&c.success.call(null,d)):(d=this.X6(f,l,c,d),d||(d=new a.dh(null,b.start),null!=c&&null!=c.success&&c.success.call(null,d)));return}}this.iZ(b,c)};a.ua.prototype.moveOK=
function(a,c,d){return this.Bf.moveOK(a,c,d)};a.b.g("FlattenedTreeDataSource.prototype.moveOK",{moveOK:a.ua.prototype.moveOK});a.ua.prototype.move=function(a,c,d,e){this.Bf.move(a,c,d,e)};a.b.g("FlattenedTreeDataSource.prototype.move",{move:a.ua.prototype.move});a.ua.prototype.DT=function(){return this.Ww-(this.Kg()+1)};a.ua.prototype.Fq=function(a,c){null!=c&&null!=c.error&&c.error.call(null,a)};a.ua.prototype.Qs=function(b,c,d,e,f,g){var k;k=[];b=new a.jh(b,this.EF.bind(this),e);this.ABa(b,c,d,
k);-1===f&&0===b.getCount()&&null!=c&&0<d?(k=this.X6(c,d,g))||null!=g&&null!=g.success&&g.success.call(null,b):0===k.length?null!=g&&null!=g.success&&g.success.call(null,b):(c=[],c.push(k),k={},k.callbacks=g,k.nodeSet=b,k.keys=[],this.Yda(c,k))};a.ua.prototype.getChildCount=function(a){return this.Bf.getChildCount(a)};a.b.g("FlattenedTreeDataSource.prototype.getChildCount",{getChildCount:a.ua.prototype.getChildCount});a.ua.prototype.X6=function(a,c,d,e){var f,g,k,l,m,r,t,s,q;void 0===e&&(e=this.DT());
this.lza()&&(f={queueOnly:!0});g=q=this.sT(-1);for(k=this.Kg()-1;0<=k;k--)if(l=this.Oj(k),m=l.depth,m<c&&(a=l.parent,r=this.Bf.getChildCount(a),l=l.index,(t=-1===r)||l<r-1)){s={};s.start=l+1;t?(s.count=Math.min(e,Math.max(0,g)),f=void 0):s.count=Math.min(e,Math.min(g,r-s.start));if(0==s.count)break;this.Bf.fetchChildren(a,s,{success:function(c){this.Qs(c,a,m,s,r,d)}.bind(this),error:function(a){this.Fq(a,d)}.bind(this)},f);c=m;g=Math.max(0,g-s.count);if(t||0===m||0===g)break}void 0!=f&&this.Bf.fetchChildren(a,
{start:s.count,count:0},{success:function(c){this.Qs(c,a,m,s,r,d)}.bind(this),error:function(a){this.Fq(a,d)}.bind(this)});return g!=q};a.ua.prototype.ABa=function(a,c,d,e){var f,g,k,l;f=a.getStart();g=a.getCount();for(k=0;k<g;k++)l=a.getMetadata(f+k),l=l.key,this.cI(l,d,f+k,c),this.KD(l)&&e.push(l)};a.ua.prototype.EF=function(a,c){this.KD(a)&&!c.leaf?c.state="expanded":c.state=c.leaf?"leaf":"collapsed"};a.ua.prototype.Rta=function(a,c){var d={maxCount:this.Ww};0<=this.Kg()&&(d.start=this.Oj(this.Kg()).key);
this.Bf.fetchDescendants(null,{success:function(d){this.Uwa(d,a,c)}.bind(this),error:function(a){this.Fq(a,c)}.bind(this)},d)};a.ua.prototype.getSortCriteria=function(){return this.Bf.getSortCriteria()};a.b.g("FlattenedTreeDataSource.prototype.getSortCriteria",{getSortCriteria:a.ua.prototype.getSortCriteria});a.ua.prototype.Uwa=function(b,c,d){var e,f,g;c.start>this.Kg()?(e=this.DT(),f=Math.min(e,c.count),b=new a.jh(b,this.EF.bind(this),null,this.km),0<=this.Kg()?(g=this.i8(),e={index:0,found:!1,
count:0},this.XV(b,null,0,g,f,e),f=e.index+1):(e={count:0},this.XV(b,null,0,null,f,e),f=0),null!=d&&null!=d.success&&(b=null!=e?0===e.count?new a.dh(null,c.start):new a.eh(b,f):new a.eh(b),d.success.call(null,b))):this.iZ(c,d)};a.ua.prototype.XV=function(a,c,d,e,f,g){var k,l,m,r,t;k=a.getStart();l=a.getCount();for(m=0;m<l&&g.count!=f;m++){r=a.getMetadata(k+m);t=r.key;g.checkDepth&&e.depth===d&&(g.found=!0,g.checkDepth=!1);if(null==e||g.found)this.cI(t,d,k+m,c),g.count+=1,r.state=r.leaf?"leaf":"expanded";
null==e||g.found||(t===e.key?r.leaf||this.KD(t)?g.found=!0:g.checkDepth=!0:g.index+=1);a.ri&&this.KD(t)&&(r=a.ri(m),null!=r&&this.XV(r,t,d+1,e,f,g))}};a.ua.prototype.expand=function(a){this.cg(a)};a.b.g("FlattenedTreeDataSource.prototype.expand",{expand:a.ua.prototype.expand});a.ua.prototype.cg=function(b,c){var d,e,f,g;d=this.Bf.getChildCount(b);e=this.sT(d);f=this.Ww;if(this.Kg()+1===f&&(g=this.dl(b),g==f-1)){this.gZ(b,new a.dh(b,0),0,c);return}0==e?this.gZ(b,new a.dh(b,0),0,c):this.Bf.fetchChildren(b,
{start:0,count:e},{success:function(a){this.gZ(b,a,d,c)}.bind(this),error:function(){this.WIa(b)}.bind(this)})};a.ua.prototype.collapse=function(a){var c,d,e,f,g;c=this.dl(a)+1;d=this.Oj(c-1);e=0;d=d.depth;f=this.Kg();for(g=c;g<f+1;g++){var k=this.Oj(g).depth;if(k>d)e+=1;else if(k==d)break}if(0!=e){this.jz()?this.km.push(a):this.sCa(a);f=[];for(d=0;d<e;d++)f.push({key:this.Oj(c+d).key,index:c+d});this.$ba(c,e);this.kO(f)}this.handleEvent("collapse",{rowKey:a})};a.b.g("FlattenedTreeDataSource.prototype.collapse",
{collapse:a.ua.prototype.collapse});a.ua.prototype.KD=function(a){return this.jz()?this.km&&0<this.km.length?-1===this.z7(a):!0:this.vr&&0<this.vr.length?-1<this.Q7(a):!1};a.ua.prototype.z7=function(a){return this.g8(this.km,a)};a.ua.prototype.Q7=function(a){return this.g8(this.vr,a)};a.ua.prototype.g8=function(a,c){var d,e;e=-1;for(d=0;d<a.length;d++)a[d]===c&&(e=d);return e};a.ua.prototype.sCa=function(a){a=this.Q7(a);-1<a&&this.vr.splice(a,1)};a.ua.prototype.mCa=function(a){a=this.z7(a);-1<a&&
this.km.splice(a,1)};a.ua.prototype.WIa=function(a){this.handleEvent("expand",{rowKey:a})};a.ua.prototype.gZ=function(b,c,d,e){var f,g,k,l,m,r,t,s,q,p,n;c=new a.jh(c,this.EF.bind(this));g=f=this.dl(b)+1;k=c.getStart();l=c.getCount();m=this.Oj(f-1);r=m.depth+1;s=[];for(q=k;q<l;q++)k=c.getMetadata(q),t=k.key,this.KD(t)&&s.push(t),this.A$(f,k,m.key,q,r),f++;this.jz()?this.mCa(b):-1===this.vr.indexOf(b)&&this.vr.push(b);void 0!=e&&(p=e.queue,n=e.prevNodeSetInfo);void 0!=n&&(c=new a.zj(n.nodeSet,c,b));
if(0!=s.length||void 0!==p&&0!=p.length)void 0===p&&(p=[]),0<s.length&&p.push(s),void 0===n&&(n={},n.firstIndex=g,n.firstKey=b,n.keys=[]),n.nodeSet=c,n.keys.push(b),this.Yda(p,n);else{if(void 0!=n){e=n.callbacks;if(null!=e){e.success.call(null,c);return}this.jN(n.firstIndex,n.firstKey,c)}else this.jN(g,b,c);c=this.Ww;-1===d&&l===this.gm()||d>l||f==c?this.wS(f):this.Kg()>=c&&this.wS(c);if(void 0!=n)for(d=0;d<n.keys.length;d++)this.handleEvent("expand",{rowKey:n.keys[d]});this.handleEvent("expand",
{rowKey:b})}};a.ua.prototype.Yda=function(a,c){var d,e;d=a[a.length-1];e=d.shift();0===d.length&&a.pop();this.cg(e,{prevNodeSetInfo:c,queue:a})};a.ua.prototype.A$=function(a,c,d,e,f){c=c.key;a<=this.Kg()?this.cI(c,f,e,d,a):this.cI(c,f,e,d)};a.ua.prototype.wS=function(a,c){var d;void 0==c&&(c=this.Kg()+1-a);d=[];for(var e=0;e<c;e++)d.push({key:this.Oj(a+e).key,index:a+e});this.$ba(a,c);this.kO(d)};a.ua.prototype.Dxa=function(a){var c,d,e;c=a.operation;d=a.parent;d=Array.isArray(d)?d[d.length-1]:d;
e=a.index;"insert"===c?this.lxa(d,e,a.data):"delete"===c?this.Fwa(d,e):"refresh"===c&&this.Txa(d)};a.ua.prototype.lxa=function(a,c,d){var e,f;e=this.dl(a);f=this.Oj(e).depth+1;e=e+c+1;d=d.getMetadata(d.getStart());this.A$(e,d,a,c,f)};a.ua.prototype.Fwa=function(b,c){var d,e,f,g,k;d=this.dl(b);e=this.Oj(d);d+=c;f=this.Oj(d);a.p.assert(f.parent===e&&f.depth===e.depth+1);e=d+1;for(g=this.Kg();e<=g;){k=this.Oj(e);if(k.depth!=f.depth)break;e++}this.wS(d,1)};a.ua.prototype.Txa=function(a){null==a&&this.refresh()};
a.ua.prototype.jz=function(){var a=this.Bf.getCapability("fetchDescendants");return void 0!=this.km&&null!=a&&"disable"!=a};a.ua.prototype.lza=function(){return"enable"===this.Bf.getCapability("batchFetch")};a.ua.prototype.refresh=function(){this.Zqa()};a.ua.prototype.dl=function(a){var c,d,e;c=this.Kg();for(d=0;d<=c;d++)if(e=this.Oj(d),e.key==a)return d;return-1};a.ua.prototype.getKey=function(a){return 0>a||a>this.Kg()?null:this.Oj(a).key};a.ua.prototype.ZHa=function(){return{start:0,end:this.Kg()+
1}};a.ua.prototype.PHa=function(a){var c;c=[];a=this.dl(a);for(a=this.ln(a);null!=a;)c.push(a),a=this.dl(a),a=this.ln(a);return c.reverse()};a.ua.prototype.iZ=function(a,c){null!=c&&null!=c.error&&c.error.call(null)};a.ua.prototype.jN=function(){a.p.kd()};a.ua.prototype.kO=function(){a.p.kd()};a.ua.prototype.Kg=function(){return this.rr.length-1};a.ua.prototype.i8=function(){return this.rr[this.Kg()]};a.ua.prototype.Oj=function(a){return this.rr[a]};a.ua.prototype.ln=function(a){a=this.rr[a];return null!=
a?a.parent:null};a.ua.prototype.cI=function(a,c,d,e,f){var g={};g.key=a;g.depth=c;g.index=d;g.parent=e;void 0===f?this.rr.push(g):this.rr.splice(f,0,g)};a.ua.prototype.$ba=function(a,c){this.rr.splice(a,c)};a.ua.prototype.Zqa=function(){this.rr.length=0};a.ua.prototype.getCapability=function(a){return this.Bf.getCapability(a)};a.b.g("FlattenedTreeDataSource.prototype.getCapability",{getCapability:a.ua.prototype.getCapability});a.Ra("oj.ojRowExpander",g.oj.baseComponent,{version:"1.0.0",widgetEventPrefix:"oj",
options:{context:null,expand:null,collapse:null},np:{root:"oj-rowexpander",icon:"oj-component-icon",clickable:"oj-clickable-icon-nocontext",expand:"oj-rowexpander-expand-icon",collapse:"oj-rowexpander-collapse-icon",leaf:"oj-rowexpander-leaf-icon",lazyload:"oj-rowexpander-lazyload-icon",toucharea:"oj-rowexpander-touch-area",indent:"oj-rowexpander-indent",iconspacer:"oj-rowexpander-icon-spacer",depth0:"oj-rowexpander-depth-0",depth1:"oj-rowexpander-depth-1",depth2:"oj-rowexpander-depth-2",depth3:"oj-rowexpander-depth-3",
depth4:"oj-rowexpander-depth-4",depth5:"oj-rowexpander-depth-5",depth6:"oj-rowexpander-depth-6",depth7:"oj-rowexpander-depth-7"},cA:{AB:7,lP:53},_ComponentCreate:function(){this._super();this.element.addClass(this.np.root);this.l$()},l$:function(){var a=this,c;c=this.options.context;this.R="function"===typeof c.component?c.component("instance"):c.component;this.yd=c.datasource;this.depth=c.depth;this.il=c.state;this.Hr=c.key;this.index=c.index;this.aO=c.parentKey;this.xpa();this.wpa();this.uL();"expanded"===
this.il||"collapsed"===this.il?(g(this.N_).on("touchend",function(c){c.preventDefault();a.$S()}),g(this.N_).on("click",function(c){c.preventDefault();a.$S()}),g(this.element).on("keypress",function(c){var e=c.keyCode||c.which;if(e===g.ui.keyCode.ENTER||e===g.ui.keyCode.SPACE)a.$S(),c.preventDefault(),c.target.focus()}),this.gN=this.C9.bind(this),g(this.R.element).on("ojkeydown",this.gN),this.pha=this.Owa.bind(this),this.jha=this.uwa.bind(this),this.yd.on("expand",this.pha,this),this.yd.on("collapse",
this.jha,this)):"leaf"===this.il&&(this.gN=this.C9.bind(this),g(this.R.element).on("ojkeydown",this.gN),g(this.icon).attr("tabindex",-1));this.hha=this.jwa.bind(this);g(this.R.element).on("ojbeforecurrentcell",this.hha)},refresh:function(){this.element.empty();this.l$()},_destroy:function(){g(this.R.element).off("ojkeydown",this.gN);g(this.R.element).off("ojbeforecurrentcell",this.hha);this.yd.off("expand",this.pha,this);this.yd.off("collapse",this.jha,this);this.element.removeClass(this.np.root);
this.element.empty()},_setOption:function(a,c,d){this._super(a,c,d);"context"==a&&null!=d._context&&!0!=d._context.internalSet&&this.refresh()},xpa:function(){var a,c;c=this.depth-1;if(c<this.cA.AB)this.iR(c);else{for(a=1;a<=c/this.cA.AB;a++)this.iR(this.cA.AB);a=c%this.cA.AB;a<this.cA.AB&&this.iR(a)}},iR:function(a){a=g(document.createElement("span")).addClass(this.np.indent).addClass(this.np["depth"+a]);this.element.append(a)},wpa:function(){var a;a=g(document.createElement("div")).addClass(this.np.iconspacer);
this.N_=g(document.createElement("div")).addClass(this.np.toucharea);this.icon=g(document.createElement("a")).attr("href","#").attr("aria-labelledby",this.h8()).addClass(this.np.icon).addClass(this.np.clickable);this.element.append(a.append(this.N_.append(this.icon)));this._focusable({element:this.icon,applyHighlight:!0})},cv:function(a){this.icon.addClass(this.np[a])},hw:function(a){this.icon.removeClass(this.np[a])},uL:function(){switch(this.il){case "leaf":this.hw("icon");this.hw("clickable");
this.cv("leaf");break;case "collapsed":this.cv("expand");this.kI(!1);break;case "expanded":this.cv("collapse");this.kI(!0);break;case "loading":this.hw("clickable"),this.cv("lazyload")}},iW:function(){switch(this.il){case "leaf":this.hw("leaf");this.cv("icon");this.cv("clickable");break;case "collapsed":this.hw("expand");break;case "expanded":this.hw("collapse");break;case "loading":this.hw("lazyload"),this.cv("clickable")}},jwa:function(a,c){var d,e;null!=c.currentCell&&(d="cell"==c.currentCell.type?
c.currentCell.keys.row:c.currentCell.key,null!=c.previousValue&&(e="cell"==c.previousCurrentCell.type?c.previousCurrentCell.keys.row:c.previousCurrentCell.key),this.Hr===d&&e!=d&&this.R.nL&&(d=this.F("accessibleRowDescription",{level:this.depth,num:this.index+1,total:this.yd.getWrappedDataSource().getChildCount(this.aO)}),e="collapsed"===this.il?this.F("accessibleStateCollapsed"):"expanded"===this.il?this.F("accessibleStateExpanded"):"",this.R.nL({context:d,state:e})))},C9:function(b,c){var d,e,f;
if(this.Hr===c.rowKey&&(b=b.originalEvent,d=b.keyCode||b.which,a.D.qr(b))){if(d==g.ui.keyCode.RIGHT&&"collapsed"===this.il)return this.vV(),this.yd.expand(this.Hr),!1;if(d==g.ui.keyCode.LEFT&&"expanded"===this.il)return this.vV(),this.yd.collapse(this.Hr),!1;if(b.altKey&&d==this.cA.lP&&this.R.nL){d=this.yd.PHa(this.Hr);if(null!=d&&0<d.length)for(e=[],f=0;f<d.length;f++)e.push({key:d[f],label:this.F("accessibleLevelDescription",{level:f+1})});d=this.F("accessibleRowDescription",{level:this.depth,num:this.index+
1,total:this.yd.getWrappedDataSource().getChildCount(this.aO)});this.R.nL({context:d,state:"",ancestors:e})}}return!0},vV:function(){this.iW();this.il="loading";this.uL()},Owa:function(a){a=a.rowKey;a===this.Hr&&(this.iW(),this.il="expanded",this.uL(),this.kI(!0),this._trigger("expand",null,{rowKey:a}),this.xea("expanded"))},uwa:function(a){a=a.rowKey;a===this.Hr&&(this.iW(),this.il="collapsed",this.uL(),this.kI(!1),this._trigger("collapse",null,{rowKey:a}),this.xea("collapsed"))},xea:function(a){var c=
this.options.context;c.state=a;this._setOption("context",c,{changed:!0,_context:{internalSet:!0}})},$S:function(){var a=this.il;this.vV();"collapsed"===a?this.yd.expand(this.Hr):"expanded"===a&&this.yd.collapse(this.Hr)},kI:function(a){this.icon.attr("aria-expanded",a)},getNodeBySubId:function(a){if(null==a)return this.element?this.element[0]:null;a=a.subId;return"oj-rowexpander-disclosure"!==a&&"oj-rowexpander-icon"!==a||null==this.icon?null:this.icon.get(0)},getSubIdByNode:function(a){return a===
this.icon.get(0)?{subId:"oj-rowexpander-disclosure"}:null},gq:function(){this._super();this.icon.attr("aria-labelledby",this.h8())},h8:function(){return this.element.parent().closest("[id]").attr("id")}});a.Components.Xa("ojRowExpander","baseComponent",{properties:{context:{type:"Object"}},methods:{getNodeBySubId:{},getSubIdByNode:{},refresh:{}},extension:{_widgetName:"ojRowExpander"}});a.Components.register("oj-row-expander",a.Components.getMetadata("ojRowExpander"))});